#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int Check(int x, int* p, int nums)
{
	for (int i = 0; i < nums; i++)
	{
		if (x == *(p + i))
		{
			return 0;
		}
	}
	return 1;
}
int main()
{
	int a[21] = { 0 };
	int b[21] = { 0 };
	int c[41] = { 0 };
	int count = 0;
	int n = 0;
	int m = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	scanf("%d", &m);
	for (int i = 0; i < m; i++)
	{
		scanf("%d", &b[i]);
	}
	for (int i = 0; i < n; i++)
	{
		if (Check(a[i], b, m) && Check(a[i],c, count))
		{
			c[count] = a[i];
			count++;
		}
	}
	for (int i = 0; i < m; i++)
	{
		if (Check(b[i], a, n) && Check(b[i],c, count))
		{
			c[count] = b[i];
			count++;
		}
	}
	for (int i = 0; i < count; i++)
	{
		printf("%d", c[i]);
		if (i < count - 1)
		{
			printf(" ");
		}
	}

	return 0;
}